package com.ssy.lingxi.purchase.model.request;

import com.ssy.lingxi.purchase.handler.annotation.DeliveryMethodAnnotation;
import com.ssy.lingxi.purchase.handler.annotation.DeliveryTypeAnnotation;
import com.ssy.lingxi.purchase.model.vo.FileUploadVO;
import lombok.Getter;
import lombok.Setter;

import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.List;

/**
 * 创建采购请购订单请求参数
 * @author wyx
 * @version 2.0.0
 * @date 2021-10-27
 */
@Setter
@Getter
public class RequisitionReq {
    /**
     * 供应商会员Id
     */
    @NotNull(message = "供应商会员Id要大于0")
    @Positive(message = "供应商会员Id要大于0")
    private Long vendorMemberId;

    /**
     * 供应商会员角色Id
     */
    @NotNull(message = "供应商会员角色Id要大于0")
    @Positive(message = "供应商会员角色Id要大于0")
    private Long vendorRoleId;

    /**
     * 供应商会员名称
     */
    @NotBlank(message = "供应商会员名称不能为空")
    @Size(max = 200, message = "供应商会员名称最长200个字符")
    private String vendorMemberName;

    /**
     * 订单预交日期，格式为yyyy-MM-dd
     */
    private String deliverTime;

    /**
     * 部门ID
     */
    @NotNull(message = "部门ID不能为空")
    private Long departmentId;

    /**
     * 部门名称
     */
    @NotEmpty(message = "部门名称不能为空")
    private String department;

    /**
     * 用途
     */
    @NotEmpty(message = "用途不能为空")
    @Size(max = 100, message = "用途最长100个字符")
    private String purpose;

    /**
     * 订单摘要
     */
    @NotEmpty(message = "订单摘要不能为空")
    @Size(max = 100, message = "订单摘要最长100个字符")
    private String digest;

    /**
     * 商品（物料）列表
     */
    @NotEmpty(message = "物料列表不能为空")
    @Valid
    private List<RequisitionProductReq> products;

    /**
     * 预交日期
     */
    @NotEmpty(message = "预交日期不能为空")
    private String advanceDeliveryDate;

    /**
     * 配送方式:
     *    1、物流
     *    2、自提
     *    3、无需配送
     */
    @DeliveryMethodAnnotation
    private Integer deliveryMethod;

    /**
     * 直送客户/客户自提:
     *   1、直送客户
     *   2、客户自提
     */
    @DeliveryTypeAnnotation
    private Integer deliveryType;

    /**
     * 送货地址
     */
    private String deliveryAddress;

    /**
     * 送货地址id
     */
    private Long deliveryAddressId;

    /**
     * 请购人ID
     */
    @NotNull(message = "请购人ID不能为空")
    private Long requisitionerId;

    /**
     * 请购人名称
     */
    @NotEmpty(message = "请购人名称不能为空")
    private String requisitioner;

    /**
     * 附件
     */
    private List<FileUploadVO> attachments;


}
